﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Data;
using Frame.Lib.Data;
using Frame.Lib.Utilities;
using Frame.Lib.Common;
using Frame.Lib.Enums;
using Frame.Lib.Core.Tool;

public partial class Admin_Tools_ExecSql : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!IsPostBack)
        {
            txtConectionString.Text = AppSetting.ConnectionString;
        }

        JSUtil.SetDivHeight("main", 100);
    }
    protected void btnOK_Click(object sender, EventArgs e)
    {
        string loginName = txtLoginName.Text.Trim();
        string password = txtPassword.Text.Trim();

        if (AdminTool.Validate(loginName,password))
        {
            DBHelper dbOper = DBHelper.Instance(txtConectionString.Text);
            string sql = txtSql.Text;
            DataTable dt = dbOper.Query(sql);
            gvList.DataSource = dt;
            gvList.DataBind();
        }
        else
        {
            JSUtil.Alert("用户名或密码错");

        }
       
    }
}
